package com.example.domain;

import com.fasterxml.jackson.annotation.JsonInclude;
import org.springframework.web.bind.annotation.ResponseBody;

@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResponseResult<T>{
    /*
    * 状态码
    * */
    private Integer code;
    /*
    * 提示信息如果有错误时，前端可以获取该字段进行提示
    * */
    private String msg;


    /**
     * 查询到的结果数据
     */
    private T data;

    public ResponseResult(Integer code,String msg){
        this.code = code;
        this.msg = msg;
    }

    public ResponseResult(Integer code,T data){
        this.code = code;
        this.data = data;
    }
    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    public void setData(T data) {
        this.data = data;
    }
    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public T getData() {
        return data;
    }
    public ResponseResult(Integer code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
